How to stop using console.log() and start using your browser’s debugger
主要转载至此文,标题有引战意味。正如评论第一的所说,断点能加速开发过程调试,但是我觉得console.log()
在生产环境中更为有用,二者没有优劣之分,根据不同的代码选择不同的方法即可。
To open Chrome Developer Tools, press Command+Option+I (Mac) or Control+Shift+I (Linux).
A breakpoint is something that your browser looks for in order to know when to pause execution of your code and allow you the opportunity to debug it.
To define values to ‘watch’, click on the watch pane at the very top and click the + symbol once it opens. Here, you can type in variable names or other expressions.